﻿using System;
using System.Web;

namespace V.Utility
{
    ///<summary>
    /// 功    能:  缓存工具类
    /// </summary>
    /// 作    者:  
    /// 创建时间:  
    /// 修正履历:
    /// 修正时间:
    public class CacheUtility
    {
        public CacheUtility() { }

        public static void SetCache(string key, object value)
        {
            HttpRuntime.Cache.Insert(key, value);
        }

        public static void SetCache(string key, object value, DateTime absoluteExpiration, TimeSpan slidingExpiration)
        {
            HttpRuntime.Cache.Insert(key, value, null, absoluteExpiration, slidingExpiration);
        }

        public static object RetrieveCacheValueByKey(string key)
        {
            return HttpRuntime.Cache[key];
        }
    }
}
